<template>
  <div class="span auto compatible">
        <input class="entering form-control" type="text" v-model="model.f_itemname">
        <button class="btu btn-success" @click = "add()">新增</button>
        <button class="btu btn-success" @click = "save()">保存</button>
  </div>
</template>

<script>
  export default {
    title: 'save-item',
    props: {
      //被选中当前安检项
      row: {
        item: Object
      }
    },
    data () {
      return {
        model: {}
      }
    },
    watch: {
      row (val) {
        this.model = Object.assign({}, this.model, val)
      }
    },
    methods: {
      save () {
        this.$resetpost('rs/logic/savemodel', {data: this.model}).then(()=>{
          this.$emit('commit')
        })
      },
      add () {
        this.model = null
      }
    }
  }
</script>

<style scoped>
  .entering{
    height:40px;
    width:200px;
    margin-left:20px;
    margin-right:20px;
    float:left;/*设置浮动，实现多列效果，div+Css布局中很重要的*/
  }
  .btu{
    margin-left: 20px;
    margin-top:7px;
    float:left;
  }
</style>
